﻿using SaaS.Model.Enums;
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using XCore.Domain.Entities;
using XCore.Domain.Enums;

namespace SaaS.Model.Entity.Systems
{
    /// <summary>
    /// 管理员操作日志
    /// </summary>
    [Table("Sys_AdminLogs")]
    public class SystemAdminLog : IEntity<int>, IHasCreationTime
    {
        [Column("LogId"), Key]
        public int Id { get; set; }

        /// <summary>
        /// 管理员Id
        /// </summary>
        public int AdminId { get; set; }
        /// <summary>
        /// 目标Id 操作某条数据
        /// </summary>
        public int TargetId { get; set; }
        /// <summary>
        /// 日志来源
        /// </summary>
        public SystemLoggerSource Source { get; set; }
        /// <summary>
        /// 系统类型
        /// </summary>
        public SystemType Type { get; set; }
        /// <summary>
        /// 执行耗时
        /// </summary>
        public int Duration { get; set; }
        /// <summary>
        /// 消息
        /// </summary>
        [StringLength(1024)]
        public string Message { get; set; }
        /// <summary>
        /// 数据 Json格式
        /// </summary>
        public string CustomData { get; set; }
        /// <summary>
        /// 请求信息
        /// </summary>
        public string RequestInfo { get; set; }
        /// <summary>
        /// 记录时间
        /// </summary>
        public DateTime CreationTime { get; set; }
        /// <summary>
        /// 创建IP
        /// </summary>
        [StringLength(32)]
        public string IP { get; set; }

    }
}
